<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<input type="submit" onclick="rep()" value="请求" />
</body>
	<script type="text/javascript">
		var inp = document.getElementsByTagName('input')[0];
		function rep(){
			var xhr = new XMLHttpRequest();
			xhr.open('get','1.php',true);
			xhr.send(null);
			xhr.onreadystatechange = function(){
				if(this.readyState == 4){
					alert(this.responseText);
				}
			}
		}
	</script>
</html>